<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
	xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
<head>
<meta charset="UTF-8" />
<title>Title</title>
<link rel="stylesheet" href="css/bootstrap.css" />
<link rel="stylesheet" href="css/bootstrap-theme.css" />
<link rel="stylesheet" href="css/new2.css" />
 

</head>
<body>
	<div class="container">
		<div class="align-center">
			<form id="addRegion" class="form-horizontal" th:object="${Region}">
				<div class="form-group">
					<label for="firstname" class="col-sm-2 control-label"><span
						class="">父级编码</span></label>
					<div class="col-sm-10">
						<select class="form-control input-sm" name="regDetailId">
							<option>请选择</option>
							<option th:each="detCodings : ${detCodingList}"
								th:value="${detCodings.detId}" th:text="${detCodings.detCoding}">
								加载中...</option>
						</select>
					</div>
				</div>
				<div class="form-group">
					<label for="lastname" class="col-sm-2 control-label"><span
						class="sb">区域编码</span></label>
					<div class="col-sm-10">
						<input type="text" class="form-control" name="regCode" />
					</div>
				</div>
				<div class="form-group">
					<label for="lastname" class="col-sm-2 control-label"><span
						class="sb">区域名称</span></label>
					<div class="col-sm-10">
						<input type="text" class="form-control" name="regName" />
					</div>
					<!-- <input id="mess" th:value="${mes}" type="text"/> -->
				</div>
				<div class="form-group">
					<div class="col-sm-offset-11 col-sm-1">
						<button type="button" class="btn btn-default" id="save" onclick="addRegion();">
						保存</button>
					</div>
				</div>
				
			</form>
		</div>
	</div>

	<script src="js/jquery.js"></script>
    <script src="js/bootstrap.min.js"></script>

    <script type="text/javascript" src="js/alertify.min.js"></script>
   
   	<script src="layer/jquery.min.js"></script>
   	<script src="layer/layer.js"></script>
   	
	<script type="text/javascript">
	function addRegion(){
			debugger;
			var formData = new FormData($("#addRegion")[0]);
			$.ajax({
				type : "POST",
	 			url : "/addBuildRe",
	 			clearForm : true,
	 			data : formData,
	 			contentType : false,
	 			processData : false,
	 			async : false,
	 			dataType : "json",
	 			success : function(data) {
	 				debugger;
	 				if (data.num == true ) {
	 					debugger;
	 					alert("添加成功!");
	 					layer.close(layer.index);  
	 			        window.parent.location.reload();
	 				} else if(data.num == false ){
	 					debugger;
	 					alert("添加失败!");
	 				}
	 			}
			});
		};
		/* layer.alert(mes,function(){
			window.parent.location.reload();
			parent.layer.close(index);
		}) */
		
		//Alertify JS
		/* $ = function(id) {
			return document.getElementById(id);
		}, reset = function() {
			$("toggleCSS").href = "css/alertify.core.css";
			alertify.set({
				labels : {
					ok : "OK",
					cancel : "Cancel"
				},
				delay : 5000,
				buttonReverse : false,
				buttonFocus : "ok"
			});
		}; */
		
		
	</script>

</body>

</html>